<!DOCTYPE HTML>
<html lang="en">
<head>
    <meta charset='UTF-8' />
    <meta name='generator' content='ecos.b2c' />
    <title>抢单</title>
    <meta name='keywords' content='会员中心__三鑫-灯世界网销平台' />
    <meta name='description' content='会员中心__三鑫-灯世界网销平台' />
    <meta name='viewport' content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no'/>
    <link href="__PUBLIC__/phone/css/zhuce_style.css" rel="stylesheet" media="screen, projection" />
    <link rel="stylesheet" href="__PUBLIC__/phone/css/styles.css" />
    <script src="__PUBLIC__/phone/js/shop.min.js"></script>
</head>
<body>
<!--公共搜索栏-->
<include file="./phone/Home/View/Public/search.html"/>
 	<div class="header-wrap">
		<header style="background: #00a1f2;border: none;">
		    <div class="a-bar">
		        <a href="javascript:history.back()" class="a-back">
		            <i class="arr left" style="top: 0px;height: 10px;width: 10px;"></i>
		        </a>
		        <div class="a-name" style="width: 30%;height: 30px;text-align: center;color:white">
		            抢单
		        </div>
		    </div>
	   </header>
    </div>
    <div class="full-screen">
	  <div class="pt-gallery">
	    <div class="tab J-tab">
	      <ul class="trigger-list">
              <li class="trigger <if condition='$act eq 1'>act</if>" onclick="window.location.href='{:U(qiang)}?act=1'">待抢订单</li>
              <li class="trigger <if condition='$act eq 2'>act</if>" onclick="window.location.href='{:U(qiang)}?act=2'">已抢订单</li>
              <li class="trigger <if condition='$act eq 3'>act</if>" onclick="window.location.href='{:U(qiang)}?act=3'">指派订单</li>
	      </ul>
	    </div>
	  </div>
    <div class="full-padding">
        <ul class="mem-order-list">
            <volist name="order_list" id="ol">
                <li class="mem-order-item">
                    <div class="gb">
                        <div class="col2">
                            <div class="col">
                                <div class="d-line">
                                    <div class="l-k">订单号：</div>
                                    <div class="l-v">{$ol.order_number}</div>
                                </div>
                                <div class="d-line">
                                    <div class="l-k">下单时间：</div>
                                    <div class="l-v">{$ol.add_time}</div>
                                </div>
                            </div>
                            <div class="col d-line">

                                <div class="t-r">
                                    <a href="{:U('orders_details')}?oid={$ol.order_number}">
                                        查看订单
                                        <i class="arr right" style="border-color: #666 !important;"></i>
                                    </a>
                                </div>
                                <if condition="$act eq 1">
                                    <div class="t-r qiang" attr="{$ol.order_number}">
                                        <a href="javascript:;">
                                            立即抢单
                                            <i class="arr right" style="border-color: #666 !important;"></i>
                                        </a>
                                    </div>
                                <elseif condition="$act eq 2"/>
                                    <if condition="$ol.install_status eq -1">
                                        <div class="t-r">
                                            <a href="javascript:;" class="succ" attr="{$ol.order_number}">
                                                安装完成
                                                <i class="arr right" style="border-color: #666 !important;"></i>
                                            </a>
                                        </div>
                                    <else/>
                                        <div class="t-r">
                                            <a href="javascript:;" style="color: red">
                                                <b>已完成</b>
                                            </a>
                                        </div>
                                    </if>
                                <elseif condition="$act eq 3"/>
                                    <if condition="$ol.install_status eq -1 AND $ol.electrician_confirm eq 0">
                                        <div class="t-r">
                                            <button class="queren" attr="{$ol.order_number}">确认</button>&nbsp;&nbsp;&nbsp;&nbsp;<button class="quxiao" attr="{$ol.order_number}">取消</button>
                                        </div>
                                    <elseif condition="$ol.install_status eq -1 AND $ol.electrician_confirm eq 1"/>
                                        <div class="t-r">
                                            <a href="javascript:;" class="succ" attr="{$ol.order_number}">
                                                安装完成
                                                <i class="arr right" style="border-color: #666 !important;"></i>
                                            </a>
                                        </div>
                                    <else/>
                                        <div class="t-r">
                                            <a href="javascript:;" style="color: red">
                                                <b>已完成</b>
                                            </a>
                                        </div>
                                    </if>
                                </if>
                            </div>
                        </div>
                    </div>
                    <ul class="mem-order-pt c-fix">
                        <volist name="ol.data" id="o">
                            <li class="mem-pt-item">
                                <a href="javascript:;">
                                    <img src="__ROOT__{$o.picture}"/>
                                </a>
                            </li>
                        </volist>

                    </ul>
                </li>
            </volist>
	  </ul>
    </div>
</div>
<!--公共底部-->
<include file="./phone/Home/View/Public/foot.html"/>

<!--抢单操作-->
<script>
    $('.qiang').click(function () {
        var order_number = $(this).attr('attr');
        $.ajax({
            url:"{:U('qiang_action')}",
            data:{'order_number':order_number},
            type:'post',
            success:function (e) {
                if(e == 1){
                    alert('恭喜您！抢单成功')
                    window.location.reload();
                }else if(e == -2){
                    alert('抱歉，订单已被抢')
                    window.location.reload();
                }else{
                    alert('数据异常，请重试')
                    window.location.reload();
                }
            }
        })
    })
    //安装完成
    $('.succ').click(function () {
        var order_number = $(this).attr('attr');
        $.ajax({
            url:"{:U('succ_action')}",
            data:{'order_number':order_number},
            type:'post',
            success:function (e) {
                if(e == 1){
                    window.location.reload();
                }else{
                    alert('数据异常，请重试');
                    window.location.reload();
                }
            }
        })
    })

    //派单接受操作
    $('.queren').click(function () {
        var order_number = $(this).attr('attr');
        $.ajax({
            url:"{:U('queren_action')}",
            data:{'order_number':order_number},
            type:'post',
            success:function (e) {
                if(e == 1){
                    window.location.reload();
                }else{
                    alert('数据异常，请重试');
                    window.location.reload();
                }
            }
        })
    });
    //派单取消操作
    $('.quxiao').click(function () {
        var order_number = $(this).attr('attr');
        $.ajax({
            url:"{:U('quxiao_action')}",
            data:{'order_number':order_number},
            type:'post',
            success:function (e) {
                if(e == 1){
                    window.location.reload();
                }else{
                    alert('数据异常，请重试');
                    window.location.reload();
                }
            }
        })
    });
</script>
</body>
</html>

